<!DOCTYPE html>
<html>
<head>
    <title>模块生成器</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap-grid.css"/>

    <link rel="stylesheet" href="css/main.css">

</head>
<body>

<div id="app">
    <div class="grid-btn">

        <div>
            <div class="row mb-3">
              <label for="dir">模块目录</label>
              <input type="text" class="form-control" id="dir" v-model="formData.dir" placeholder="默认可以不填">
            </div>

            <div class="row mb-3">
              <label for="name">模块名称 </label>
              <input type="text" class="form-control" id="name" v-model="formData.name">
            </div>

            <div class="row mb-3">
              <label for="desc">模块描述 </label>
              <input type="text" class="form-control" id="desc" v-model="formData.desc">
            </div>
        </div>
      <div class="row">
        <button type="button" class="btn btn-primary btn-sm" @click="submit"> 生成模块
        </button>
      </div>

    </div>
</div>

</body>

<script src=" https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"> </script>
<script src=" https://cdnjs.cloudflare.com/ajax/libs/vue/2.3.4/vue.min.js"></script>
<script >
let app = new Vue({
    el:'#app',
    data:{
      searchName: '',
      formData: {
        dir: "",
        name: "", // limit item size in a page
        desc: ""
      },
    },
    mounted: function () {
    },
    methods: {
      submit: function() {
        if (this.formData.name.length >0) {
          let url = "sys/generator/module?name=" + this.formData.name;
          if (this.formData.dir.length >0) {
            url = url + "&dir=" + this.formData.dir
          }
          if (this.formData.desc.length >0) {
            url = url + "&desc=" + this.formData.desc
          }
          location.href = url
        }
      }
    }
  });
</script>

</html>
